package com.dyna.core.event;

import com.dyna.constants.DateFatter;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.time.LocalDateTime;

/**
 * 全局异常保存信息对象
 * @author zhoucaiwang
 * @date 2024/1/10
 */

@Data
public class DynaGlobalExceptionEntity {

    public DynaGlobalExceptionEntity(Integer type, String msg) {
        this.type = type;
        this.msg = msg;
        this.createTime = LocalDateTime.now();
    }

    @ApiModelProperty(value = "错误服务类型")
    private Integer type;

    @ApiModelProperty(value = "错误消息")
    private String msg;

    /**
     * JSONField 可以在转json的时候转换成指定格式的日期时间
     */
    @ApiModelProperty(value = "创建时间")
    @JsonFormat(pattern = DateFatter.YYYY_MM_DD_HH_MM_SS)
    private LocalDateTime createTime;

}
